File

@Serializable
@SerialName(value = "file")
data class File(val mediaType: String, val base64: String = "", val filename: String? = null, val providerMetadata: Map<String, JsonElement>? = null, val url: String? = null) : ContentPart

File content — payload data the model produced or that's attached to a turn. Per historical parity gap #38, mirrors v6's richer FilePart.data. Currently base64 is the only data shape; a URL-shaped variant lives in Source. filename is the user-facing label (Anthropic models produce it for artifact-like outputs; v6 has a dedicated slot for it).

Constructors

Link copied to clipboard
constructor(mediaType: String, base64: String = "", filename: String? = null, providerMetadata: Map<String, JsonElement>? = null, url: String? = null)

Properties

Link copied to clipboard
Link copied to clipboard

Optional display name. v6 calls this filename.

Link copied to clipboard
Link copied to clipboard
val ContentPart.metadata: Map<String, JsonElement>?
Link copied to clipboard
val providerMetadata: Map<String, JsonElement>?
Link copied to clipboard
val url: String?

Remote (or data) URL for the file content, when not provided inline as base64. Mirrors v6's data: DataContent | URL. Resolve with convertToLanguageModelPrompt for providers that don't accept URLs.

Functions

Link copied to clipboard
inline fun <T> ContentPart.providerMetadataAs(provider: String): T?
fun <T> ContentPart.providerMetadataAs(provider: String, serializer: KSerializer<T>): T?